package com.ha7419x.aop;

import com.ha7419x.anno.AppAnno;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Objects;

@Aspect
@Component
@Order(1)
public class AppAop {

    @Around("@annotation(appAnno)")
    public void doCheck(ProceedingJoinPoint joinPoint, AppAnno appAnno) throws Throwable {
        if (Objects.equals(appAnno.value(), "1")) {
            System.out.println("&&&&&&代理&&&&&&&&");
            joinPoint.proceed();
        }
    }
}
